#include <iostream>
#include <vector>
#include <utility>

using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::pair;
using std::make_pair;

void Input(vector<vector<int> > *matrix) {
    size_t n;
    cin >> n;
    matrix->resize(n, vector<int>(n));
    for (size_t i = 0; i < n; ++i) {
        for (size_t j = 0; j < n; ++j) {
            cin >> matrix->operator[](i)[j];
        }
    }
}

template <typename T>
bool In_matrix(vector<vector<T> > *matrix,
                               pair<size_t, size_t> pos) {
    return (0 <= pos.first && pos.first < matrix->size() &&
            0 <= pos.second && pos.second < matrix->size());
}

template <typename T>
T Matrix_value(vector<vector<T> > *matrix,
                               pair<size_t, size_t> pos) {
    return matrix->operator[](pos.first)[pos.second];
}

template <typename T, typename Comp>
pair<size_t, size_t> Check_extr(vector<vector<T> > *matrix,
                                pair<size_t, size_t> pos_min,
                                Comp cmp) {
    vector<pair<int, int>> step = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
    pair<size_t, size_t> check;
    for (auto &step_kind: step) {
        check = pos_min;
        check.first += step_kind.first;
        check.second += step_kind.second;
        if (In_matrix(matrix, check) && cmp(Matrix_value(matrix, check),
                                         Matrix_value(matrix, pos_min))) {
            return check;
        }
    }
    return pos_min;
}

bool In_quater(pair<size_t, size_t> left_down,
               pair<size_t, size_t> right_up,
               pair<size_t, size_t> pos) {
    return (left_down.first <= pos.first && pos.first <= right_up.first &&
            left_down.second <= pos.second && pos.second <= right_up.second);
}

template <typename T, typename Comp>
pair<size_t, size_t> Extremum(vector<vector<T> > *matrix,
                              pair<size_t, size_t> left_down,
                              pair<size_t, size_t> right_up,
                              Comp cmp) {
    if (left_down == right_up) {
        return left_down;
    }
    vector<vector<T> > &m = *matrix;
    pair<size_t, size_t> center = make_pair((left_down.first + right_up.first) / 2,
                                            (left_down.second + right_up.second) / 2);
    pair<size_t, size_t> pos_min = center;
    for (size_t i = left_down.first; i <= right_up.first; ++i) {
        if (cmp(m[i][center.second], Matrix_value(matrix, pos_min))) {
            pos_min = make_pair(i, center.second);
        }
    }
    for (size_t j = left_down.second; j <= right_up.second; ++j) {
        if (cmp(m[center.first][j], Matrix_value(matrix, pos_min))) {
            pos_min = make_pair(center.first, j);
        }
    }
    pair<size_t, size_t> go_quater = Check_extr(matrix, pos_min, cmp);
    if (go_quater == pos_min) {
        return pos_min;
    }
    pair<size_t, size_t> left_down_q, right_up_q;
    left_down_q = left_down;
    right_up_q = center;
    if (In_quater(left_down_q, right_up_q, go_quater)) {
        return Extremum(matrix, left_down_q, right_up_q, cmp);
    }
    left_down_q = center;
    right_up_q = right_up;
    if (In_quater(left_down_q, right_up_q, go_quater)) {
        return Extremum(matrix, left_down_q, right_up_q, cmp);
    }
    left_down_q = make_pair(left_down.first, center.second);
    right_up_q = make_pair(center.first, right_up.second);
    if (In_quater(left_down_q, right_up_q, go_quater)) {
        return Extremum(matrix, left_down_q, right_up_q, cmp);
    }
    left_down_q = make_pair(center.first, left_down.second);
    right_up_q = make_pair(right_up.first, center.second);
    if (In_quater(left_down_q, right_up_q, go_quater)) {
        return Extremum(matrix, left_down_q, right_up_q, cmp);
    }
}

void Output(pair<size_t, size_t> answer) {
    cout << answer.first + 1 << " " << answer.second + 1 << endl;
}

int main() {
    vector<vector<int> > matrix;
    Input(&matrix);
    size_t n = matrix.size();
    --n;
    pair<size_t, size_t> answer = Extremum(&matrix, make_pair(0, 0), make_pair(n, n), std::less<int>());
    Output(answer);
}
